using Shared.Domain.Shared.Enums.UserService;
using SqlSugar;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;

namespace UserService.Domain.Entities;

/// <summary>
/// 好友关系实体 - 管理用户之间的关系
/// </summary>
[SugarTable("Friendships")]
public class Friendship : Entity<Guid>, IHasCreationTime
{
    /// <summary>
    /// 好友关系唯一标识
    /// </summary>
    [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
    public override Guid Id { get; protected set; }

    /// <summary>
    /// 源用户ID（发起好友请求的用户）
    /// </summary>
    [SugarColumn(IsNullable = false)]
    public Guid SourceUserId { get; set; }

    /// <summary>
    /// 目标用户ID（被添加为好友的用户）
    /// </summary>
    [SugarColumn(IsNullable = false)]
    public Guid TargetUserId { get; set; }

    /// <summary>
    /// 好友关系状态
    /// </summary>
    [SugarColumn(IsNullable = false)]
    public FriendshipStatus Status { get; set; } = FriendshipStatus.Accepted;

    /// <summary>
    /// 源用户对目标用户的备注名
    /// </summary>
    [SugarColumn(Length = 50, IsNullable = true)]
    public string Remark { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(IsNullable = false)]
    public DateTime CreationTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 最后互动时间
    /// </summary>
    [SugarColumn(IsNullable = true)]
    public DateTime? LastInteractionTime { get; set; }
}